package com.turing.post.tuxedo.util;

import java.io.Serializable;
import java.util.Date;

import org.jdom2.Element;

import com.turing.post.util.PCPSApplicationException;

/**
 * 卡验证输出
 * 
 * @author yxb
 * 
 */
@SuppressWarnings("serial")
public class OValidate extends TransResponse implements Serializable {
	/**
	 * 卡号
	 */
	public String cardNo = "";

	/**
	 * 有效期
	 */
	public Date expired = null;

	/**
	 * 产生计算MAC的域
	 */
	@Override
	protected void generateMacField() {
		appendMacField(cardNo);
		appendMacField(TransXmlHelper.getExpired(expired));
	}

	/**
	 * 构造交易应答私有报文体
	 * 
	 * @param reqBody
	 * @throws Exception
	 */
	@Override
	protected void constructRespBodyXml(Element respBody)
			throws PCPSApplicationException {
		// 卡号
		TransXmlHelper.addStringElement(respBody,
				TransXmlHelper.XML_NODE_CardNo, cardNo);
		// 有效期
		TransXmlHelper.addStringElement(respBody,
				TransXmlHelper.XML_NODE_Expired, TransXmlHelper
						.getExpired(expired));
	}
}
